package kr.co.sdworld.api.apns.service;

import kr.co.sdworld.api.apns.model.ApnsLogin;
import kr.co.sdworld.api.apns.repository.login.ApnsLoginDao;
import kr.co.sdworld.stone.SpringBeanUtil;
import kr.co.sdworld.webs.ServiceContext;

import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService
{
	@Override
	public int login( String id, String pw)
	{
		ApnsLogin login = SpringBeanUtil.repository( ApnsLoginDao.class).getLoginInfo( id);
		if ( login != null)
		{
			if ( pw.equals( login.getUserPw()))
			{
				ServiceContext.getSession().setAttribute( "login", login);
				return 1;
			}
		}
		return -1;
	}
}
